<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/common/common.jsp" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"> 
  <head>
    <base href="<%=basePath%>" />
    <title>Allocator Data Upload Information</title>
    <script type="text/javascript">
		var path = "<%=basePath%>";
	</script>
	<meta http-equiv="pragma" content="no-cache" />
	<meta http-equiv="cache-control" content="no-cache" />
	<meta http-equiv="expires" content="0" />    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3" />
	<meta http-equiv="description" content="This is my page" />
	<link rel="stylesheet" type="text/css" href="<%=basePath%>beshs/css/content.css" />
	<link type="text/css" href="<%=basePath%>beshs/css/frame_style.css" rel="stylesheet" />
	<link type="text/css" href="<%=basePath%>beshs/css/element_style.css" rel="stylesheet" />
	<script type="text/javascript" src="<%=basePath%>resources/jquery/jquery-1.7.2.min.js"></script>
	<!-- 页面特效 -->
	<jsp:include page="/beshs/res-refer/page-effect-reference.jsp" />
	<!-- 系统通用资源 -->
	<jsp:include page="/resources/resource-refer/common-resource-reference.jsp" />
	<!-- 用户访问菜单路径 -->
	<jsp:include page="/resources/usertrace/common-uservisit-reference.jsp" />
	<!-- iframe高度自适应 -->
	<script type="text/javascript">
        function getOsName() { 
    		var OsObject = ""; 
		   	if(navigator.userAgent.indexOf("MSIE")>0) { 
		    	return "MSIE"; 
		   	} 
		   	if(isFirefox=navigator.userAgent.indexOf("Firefox")>0){ 
		        return "Firefox"; 
		   	} 
		   	if(isSafari=navigator.userAgent.indexOf("Safari")>0) { 
		        return "Safari"; 
		   	}  
		  	if(isCamino=navigator.userAgent.indexOf("Camino")>0){ 
		        return "Camino"; 
		   	} 
		   	if(isMozilla=navigator.userAgent.indexOf("Gecko/")>0){ 
		        return "Gecko"; 
		   	} 
		} 
        
        /** 根据浏览器类型选择iframe自适应方式 **/
        function setIframeHeightAutosize() {
        	//获取Iframe对象 ie和firefox都可以获得
        	var meterDataIframe = document.getElementById("meterDataPage"); 
        	var questionDataIframe = document.getElementById("questionDataPage"); 
        	var pickDataPageIframe = document.getElementById("pickDataPage"); 
        	try{
                if(getOsName() == 'MSIE'){
                    var lbHeight = meterDataIframe.document.body.scrollHeight; //IE
                    if(lbHeight==0){
                    	lbHeight = 600;}
                    meterDataIframe.style.height =  lbHeight + "px"; 
                    var qbHeight = questionDataIframe.document.body.scrollHeight; //IE
                    if(qbHeight==0){
                    	qbHeight = 600;}
                    questionDataIframe.style.height =  qbHeight + "px"; 
                    var pdHeight = pickDataPageIframe.document.body.scrollHeight; //IE
                    if(pdHeight==0){
                    	pdHeight = 600;}
                    pickDataPageIframe.style.height =  pdHeight + "px"; 
                    
                }else if(getOsName() == 'Firefox'){
                    var lfHeight = meterDataIframe.contentDocument.body.scrollHeight; //FireFox 
                    if(lfHeight==0){
                    	lfHeight = 600;}
                    meterDataIframe.height = lfHeight + "px";
                    var qfHeight = questionDataIframe.contentDocument.body.scrollHeight; //FireFox 
                    if(qfHeight==0){
                    	qfHeight = 600;}
                    questionDataIframe.height = qfHeight + "px";   
                    var pdHeight = pickDataPageIframe.contentDocument.body.scrollHeight; //FireFox 
                    if(pdHeight==0){
                    	pdHeight = 600;}
                    pickDataPageIframe.height = pdHeight + "px";   
                } else {
                    meterDataIframe.style.height = 400 + "px";
                    questionDataIframe.style.height = 400 + "px";
                    pickDataPageIframe.style.height =  400 + "px"; 
                }          
            } catch (ex){}
		}
		
		$(function() {
			setIframeHeightAutosize();
		})
    </script>
  </head>
  <body>
  	<div class="content_all">
  		<!--导航条-->
  		<div class="insertinfo_table">
		  	<table width="100%" border="0" cellspacing="0" cellpadding="0">
		  		<tr>
		  			<th style="text-align: center;" colspan="6" >Allocator Data Upload Information</th>
		  		</tr>
		  		<tr>
		  			<th>Project：</th>
		          	<td><s:property value='project.projectName' /></td>
		          	<th>District:</th>
		        	<td><s:property value='community.communityName' /></td>
		  			<th>Building：</th>
		          	<td><s:property value='building.buildingID' /></td>
		  		</tr>
		  		<tr>
		        	<th>Concentrator No.：</th>
		          	<td><s:property value="meterDataStatis.concentratorNo" />
		          	</td>
		          	<th>Meter Reading Time：</th>
		          	<td><s:date name='meterDataStatis.recordTime' format='yyyy-MM-dd' nice='false' /></td>
		          	<th>Upload Quantity：</th>
		        	<td><s:property value='meterDataStatis.uploadCount' /></td>
		        </tr>
		  		<tr>
		        	<th>Allocator Quantity：</th>
		        	<td><s:property value='meterDataStatis.assignMeterCount' /></td>
		        	<th>Successful Upload Quantity：</th>
		        	<td><s:property value='meterDataStatis.saveSuccessCount' /></td>
		        	<th>Upload Ratio：</th>
		        	<td>
		        		<s:text name="fmt.number.precision.three">
		          			<s:param value='meterDataStatis.uploadPercent' />
		          		</s:text>
		          		%
		        	</td>
		        </tr>
		        <tr>
		        	<th>Upload Time：</th>
		          	<td colspan="5"><s:date name='meterDataStatis.readTime' format='yyyy-MM-dd' nice='false' /></td>
		        </tr>
		        <tr>
		        	<th>Matching Information：</th>
		        	<td  style="white-space: normal;" colspan="5">
		        		<s:if test="batch2BaseinfoMatch != null">
		        			<span style="color: red;">Please check wheather the follow Allocator No. has complete document：</span><br/>
		        			<s:property value='batch2BaseinfoMatch' />
		        		</s:if>
		        	</td>
		        </tr>
		        <tr>
		        	<th>Updating time：</th>
		        	<td>
		        		<s:date name='meterDataStatis.updateTime' format='yyyy-MM-dd HH:mm:ss' nice='false' />
		        	</td>
		        	<td style="border:none">
          				<script type="text/javascript">
          					$(function() {
          						$("input[name='goBack']").click(function() {
          							window.location = path + "beshs/assignMeterDataStatisticsAction!queryMeterStatisticsPage.do?date="+new Date();
          						});
          						
//           						$("select[name='dataType']").hide("fast");
//           						$("span[name='txtDebug_txtTips']").hide("fast");
//           						$("input[name='txtDownload']").hide("fast");
								$("td[name='txtDebug']").hide("fast");
          						$("input[name='txtDebug']").click(function() {
          							var displayStyle = $("td[name='txtDebug']").css("display");
          							if(displayStyle == "none") {
//           								$("select[name='dataType']").show("fast");
//           								$("span[name='txtDebug_txtTips']").show("fast");
//           								$("input[name='txtDownload']").show("fast");
										$("td[name='txtDebug']").show("fast");
          							} else {
//           								$("select[name='dataType']").hide("fast");
//           								$("span[name='txtDebug_txtTips']").hide("fast");
//           								$("input[name='txtDownload']").hide("fast");
										$("td[name='txtDebug']").hide("fast");
          							}
          						});
          						
          						$("input[name='txtDownload']").click(function() {
          							var dataType = $("select[name='dataType']").val();
          							if(dataType == "") {
          								Dialog.alert("Please select the data type to be exported！", function() {
          									$("select[name='dataType']").focus();
          								});
          							}
          							var meterDataStatisUID = "<s:property value='meterDataStatis.id' />";
          							if(dataType==2 || dataType==3) {
          								window.location = path + "beshs/assignMeterDataGatherAction!downloadDebugTxt.do?meterDataStatisUID="+meterDataStatisUID+"&dataType="+dataType+"&date="+new Date();
          							} else if(dataType == 4) {
          								window.location = path + "beshs/assignMeterDataGatherAction!downloadDebugTxt.do?meterDataStatisUID="+meterDataStatisUID+"&date="+new Date();
          							}
          						});
          					})
          				</script>
            			<input name="goBack" type="reset" value="Return" class="s_btn"/>&nbsp;&nbsp;
            			<input name="txtDebug" type="reset" value="TXT Debugging" class="s_btn"/></td>
            		<td name="txtDebug" align="right">Export Type：</td>
            		<td name="txtDebug" colspan="2">
            			<s:select name="dataType" list="#{'2':'Fixed-point Upload Data via GRPS', '3':'Upload Data from Handheld Device', '4':'All Data'}" headerKey="" headerValue="Please select" cssClass="s_sel" ></s:select>
	            		<input name="txtDownload" type="reset" value="TXT Download" class="s_btn"/></td></td>
		        </tr>
		    </table>
		</div>
	</div>
	<div class="clear"></div>
	<div class="content_all">
		<!--查询列表-->
  		<ul class="nav_menu"><!--选项卡开始-->
    		<li class="selected"><span>Upload Data</span></li>
    		<li><span>Problem Data</span></li>
    		<li><span>Fail to Upload Data</span></li>
  		</ul>
  		<div class="nav_content">
   	 		<div class="ct">
   	 			<!-- 批次上传的分配表数据列表 -->
  				<script type="text/javascript">
  					$(function() {
  						//分配表数据的上传任务批次
  						var concentratorNo = "<s:property escape='false' value='meterDataStatis.concentratorNo' />";
  						var recordTime = "<s:date name='meterDataStatis.recordTime' format='yyyy-MM-dd' nice='false' />";
  						window.frames["meterDataPage"].location = path + "beshs/assignMeterDataGatherAction!queryMeterDataPageByUploadBatchByColor.do?concentratorNo="+encodeURIComponent(concentratorNo)
  								+"&recordTime="+recordTime
  								+"&date="+new Date();
  					});
  				</script>
  				<iframe frameborder="0" scrolling="auto" name="meterDataPage" id="meterDataPage" src="" height="100%" width="100%"></iframe>
   	 		</div>
    		<div class="ct">
    			<!-- 批次上传的分配表数据手动调试页面 -->
  				<script type="text/javascript">
  					$(function() {
  						//分配表数据的上传任务批次
  						var concentratorNo = "<s:property escape='false' value='meterDataStatis.concentratorNo' />";
  						var recordTime = "<s:date name='meterDataStatis.recordTime' format='yyyy-MM-dd' nice='false' />";
  						window.frames["questionDataPage"].location = path + "beshs/assignMeterDataGatherAction!queryQuestionData.do?concentratorNo="+encodeURIComponent(concentratorNo)
  								+"&recordTime="+recordTime
  								+"&date="+new Date();
  					});
  				</script>
    			<iframe frameborder="0" name="questionDataPage" scrolling="auto" id="questionDataPage" src="" height="90%" width="100%"></iframe>
    		</div>
    		<div class="ct">
    		  				<script type="text/javascript">
  					$(function() {
  						//分配表数据的上传任务批次
  						var concentratorNo = "<s:property escape='false' value='meterDataStatis.concentratorNo' />";
  						var recordTime = "<s:date name='meterDataStatis.recordTime' format='yyyy-MM-dd' nice='false' />";//应该传入上传时间
  						var readTime = "<s:date name='meterDataStatis.readTime' format='yyyy-MM-dd' nice='false' />";
  						window.frames["pickDataPage"].location = path + "beshs/assignMeterDataGatherAction!pickOutData.do?concentratorNo="+encodeURIComponent(concentratorNo)
  								+"&recordTime="+recordTime
  								+"&readTime="+readTime
  								+"&date="+new Date();
  					});
  				</script>
    			<iframe frameborder="0" name="pickDataPage" scrolling="auto" id="pickDataPage" src="" height="90%" width="100%"></iframe>
    		</div>
  		</div><!--选项卡结束-->
	</div>
  </body>
</html>
